<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>单页文章管理管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
<div class="main-content">
    <tags:breadcrumb menuId="单页管理" />
    <div class="page-content">
        <table id="contentTable" class="table table-striped table-bordered table-hover">
            <thead>
            <tr>
                <th>类型</th>
                <th>类型编码</th>
                <th>中文名称</th>
                <th>英文名称</th>
                <th>创建时间</th>
                <th>创建人</th>
                <shiro:hasPermission name="cms:singleArticle:edit">
                    <th>操作</th>
                </shiro:hasPermission></tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="singleArticle">
                <tr>
                    <td>${singleArticle.type}</td>
                    <td>${singleArticle.code}</td>
                    <td><a href="${ctx}/cms/singleArticle/form?id=${singleArticle.id}">${singleArticle.title}</a></td>
                    <td>${singleArticle.entitle}</td>
                    <td><fmt:formatDate value="${singleArticle.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                    <td>${singleArticle.createByName}</td>
                    <shiro:hasPermission name="cms:singleArticle:edit"><td>
                        <a href="${ctx}/cms/singleArticle/form?id=${singleArticle.id}">修改</a>
                        <a href="javascript:;" onclick="deleteMsg('确认要删除该单页文章吗？','${ctx}/cms/singleArticle/delete?id=${singleArticle.id}',this);">删除</a>
                    </td></shiro:hasPermission>
                </tr>
            </c:forEach>
            </tbody>
        </table>
        <div class="pagination">${page}</div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {

    });

    //删除
    function deleteMsg(msg,href,tr){
        layer.confirm(msg,function(index){
            $.post(href,function(data){
                if(data.success){
                    layer.alert(data.msg, {icon: 1},function(index){
                        $(tr).parent().parent().remove();
                        layer.close(index);
                    });
                }else {
                    layer.alert(data.msg, {icon: 2});
                }
                layer.close(index);
            });
        });
    }

    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
</script>
</body>
</html>
